package topcoder.srm479;

public class TheAirTripDivTwo {
	public int find(int[] flights, int fuel) {
		int ans = 0;

		for (int fl : flights) {
			if (fl > fuel)
				break;
			fuel -= fl;
			ans++;
		}

		return ans;

	}

	public static void main(String[] args) {
		TheAirTripDivTwo th = new TheAirTripDivTwo();
		int[] flights = { 8, 7, 7, 1, 5, 7, 9 };
		int fuel = 21;
		System.out.println(th.find(flights, fuel));
	}

}
